<include file="public:header" />
<!--菜单添加-->
<ul id="mytab" class="nav nav-tabs" style="margin-top: 15px;">
    <li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>
    <li class="active"><a href="#con1" data-toggle="tab">{:L('add_article_cate')}</a></li>
    <!--<li><a href="#con2" data-toggle="tab">菜单添加1</a></li>-->
</ul>
<div id="tabContent" class="tab-content">
    <div class="tab-pane fade in active" id="con1">
        <div style="margin-top: 20px;">
            <form class="form-horizontal" role="form" action="{:u('superadmin/article_cate/add')}" method="post">

                <div class="form-group">
                    <label class="col-sm-1 control-label label-form">父级分类:</label>
                    <div class="col-sm-3 input-padding">
                        <select class="form-control" name="pid">
                            <option value="0">一级分类</option>
                            {$select_menus}
                        </select>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-1 control-label label-form">文章分类:</label>
                    <div class="col-sm-3 input-padding">
                        <input type="text" class="form-control" name="cate_name" id="cate_name"
                               placeholder="请输入文章分类">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-1 control-label label-form">所属类型:</label>
                    <label class="checkbox-inline">
                        <input type="radio" name="type"  value="1" checked="checked"> 文章栏目
                    </label>
                    <label class="checkbox-inline">
                        <input type="radio" name="type" value="2"> 单页栏目
                    </label>
                </div>


                <div class="form-group">
                    <label class="col-sm-1 control-label label-form">seoTitle:</label>
                    <div class="col-sm-3 input-padding">
                        <input type="text" class="form-control" name="seo_title" id="seo_title"
                               placeholder="请输入seo_title">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-1 control-label label-form">seo关键字:</label>
                    <div class="col-sm-3 input-padding">
                        <input type="text" class="form-control" name="seo_keywords" id="seo_keywords"
                               placeholder="请输入seo_keywords">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-1 control-label label-form">seo描述:</label>
                    <div class="col-sm-3 input-padding">
                        <textarea class="form-control" name="seo_description" placeholder="请输入seo_description" rows="3"></textarea>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-1 control-label label-form">状态:</label>
                    <label class="checkbox-inline">
                        <input type="radio" name="status"  value="1" checked="checked"> 是
                    </label>
                    <label class="checkbox-inline">
                        <input type="radio" name="status" value="0"> 否
                    </label>
                </div>

                <div class="form-group">
                    <button id="save" class="btn btn-primary btn-position">保存</button>
                </div>

            </form>

        </div>
    </div>
</div>


<include file="public:footer" />
<script>
$(document).ready(function(){
    $('#mytab a').click(function (e) {
        e.preventDefault()
        $(this).tab('show')
    })

    $('#save').click(function(){
        var cate_name     = $.trim($('#cate_name').val());
        if(!cate_name)
        {
            $('#cate_name').val('').focus();
            layer.tips('请输入文章分类', '#cate_name', {
                tips: [2, '#009f95'],
                time: 2000
            });
            return false;
        }

        //数据验证
        $.ajax({
            type: "POST",
            url: $('.form-horizontal').attr('action'),
            data: $('.form-horizontal').serialize(),
            dataType: "json",
            success:function(data){
                if(data.status)
                {
                    layer.msg(data.msg,{icon: 1,time:2000, shade: [0.1, '#ccc']},function(){
                        window.location.href="{:u('superadmin/article_cate/add')}";
                    })
                } else {
                    layer.msg(data.msg,{icon: 2,time:2000, shade: [0.1, '#ccc']})
                }

            }
        });
        return false;
    });



});
</script>
</body>
</html>